package com.wzxl.config.shiro;

import org.apache.shiro.session.Session;
import org.apache.shiro.session.mgt.SessionContext;
import org.apache.shiro.web.servlet.ShiroHttpServletRequest;
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
import org.apache.shiro.web.util.WebUtils;

import javax.servlet.http.HttpServletRequest;

/**
 * @author 马浩 mahao@aowlx.onaliyun.com
 * @Package com.wzxl.config.shiro
 * @Description: TODO ( 处理URL中的JSESSIONID )
 * @Date 2018/4/21 11:16
 * @Version V1.0
 */
public class CustomWebSessionManager extends DefaultWebSessionManager {

    @Override
    protected void onStart(Session session, SessionContext context) {
        super.onStart(session,context);
        HttpServletRequest request = WebUtils.getHttpRequest(context);
        request.setAttribute(ShiroHttpServletRequest.REFERENCED_SESSION_ID_SOURCE, ShiroHttpServletRequest.COOKIE_SESSION_ID_SOURCE);
    }
}
